<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
  xmlns:c="livcos.org/ns/cosmos"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="c f">
  
  <xsl:import href="./style/meta_content.xsl"/>
  <xsl:import href="./style/view.xsl"/>
	<xsl:import href="style/web.xsl"/>
  
  <xsl:variable name="view" select="'meta'"/>
  <xsl:param name="scope" select="'cosmos'"/>
  
  <xsl:template match="/*">
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      	<meta name="to-root-path" content="{$toRootPath}"/>
      	<link href="{f:caller-uri(resolve-uri('css/styles.css'))}" rel="stylesheet" type="text/css" />
        <link href="{f:caller-uri(resolve-uri('css/webXml.css'))}" rel="stylesheet" type="text/css" />
      	<xsl:call-template name="page_css"/>
      	<xsl:call-template name="page_scripts"/>
      </head>
      <body>
      	<xsl:call-template name="page_content"/>
      </body>
    </html>
  </xsl:template>
  
	<xsl:template name="page_content">
		<div id="{f:object-id(.)}" class="contentPanel" style="background-color: white;">
			<div class="content">
				<p style="margin-left: 0px;">
					<span style="font-variant: small-caps;">Raw <xsl:value-of select="$scope"/> Data for </span>
					<xsl:value-of select="f:object-id(.)"/>
				</p>
				<xsl:apply-imports/>
			</div>
		</div>
	</xsl:template>
	
	<xsl:template name="page_css">
	</xsl:template>
	
	<xsl:template name="page_scripts">
		<script type="text/javascript" src="{f:caller-uri(resolve-uri('script/util.js'))}">
			<xsl:comment> </xsl:comment>
		</script>
		<script type="text/javascript" src="{f:caller-uri(resolve-uri('script/E.js'))}">
			<xsl:comment> </xsl:comment>
		</script>
		<script type="text/javascript" src="{f:caller-uri(resolve-uri('script/init.js'))}">
			<xsl:comment> </xsl:comment>
		</script>
	</xsl:template>
	
	<xsl:template name="printNamespaceDecls">
		<xsl:variable name="p" select=".."/>
		<xsl:for-each select="namespace::*[local-name(.) != 'xml']">
			<xsl:variable name="prefix" select="local-name(.)"/>
			<xsl:variable name="nsUri" select="."/>
			<xsl:if test="not($p/..) or (namespace-uri-for-prefix($prefix, $p) != $nsUri)">
				<xsl:call-template name="printNS">
					<xsl:with-param name="prefix" select="$prefix"/>
					<xsl:with-param name="nsUri" select="$nsUri"/>
				</xsl:call-template>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	
  <xsl:template match="xsl:import/@href" mode="attr_val">
  	<xsl:variable name="uri" select="concat(f:cut-end(resolve-uri(., base-uri(.)), '.xsl'), '.html')"/>
    <a class="attrVal" href="{f:caller-uri($viewObjId, $uri)}"><xsl:value-of select="." /></a>
  </xsl:template>
  
</xsl:stylesheet>